﻿@model Zor_Web.Models.Base.V_Zor_Evaluate
@using Webdiyer.WebControls.Mvc;
@using Zor_Tools;
@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>评定管理</title>
    <link href="~/Content/LayerUI/src/css/layui.css" rel="stylesheet" />
    <link href="~/Content/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
    <link href="~/Content/Styles/zor.css" rel="stylesheet" />
    <!-- 框架必要 -->
    <script src="~/Content/Scripts/jquery/jquery-1.9.1.min.js"></script>
    <script src="~/Content/Scripts/learunui-framework.js"></script>
    <script src="~/Content/Scripts/Zor_AJax.js"></script>
    <!-- 消息提示 -->
    <script language='javascript' src='~/Content/layer/layer.js'></script>
    <!-- 日期选择器 -->
    <script src="~/Content/laydate/laydate.js"></script>
    <!-- 表单验证 -->
    <script src="~/Content/Scripts/JValidator.js"></script>
    <!-- 税收算法 -->
    <script src="~/Content/Scripts/RatMoney.js"></script>
</head>
<body class="gray-bg">
    <div class="layui-tab layui-tab-brief main-tab-container ">

        <div class="col-sm-12 ct-padding">
            <div class="col-sm-8 ct-padding">
                <button id="btnUpdate" class="layui-btn layui-btn-normal layui-btn-small"><span class="glyphicon glyphicon-pencil"></span> 评定</button>
                <button id="btnSearchFull" class="layui-btn  layui-btn-normal layui-btn-small"><span class="glyphicon glyphicon-search"></span>查询</button>
                <button id="btnMessage" class="layui-btn layui-btn-orchid  layui-btn-small"><span class="glyphicon glyphicon-list-alt"></span>详情</button>
                <button id="btnRefresh" class="layui-btn layui-btn-blue layui-btn-small"><span class="glyphicon glyphicon-repeat"></span>刷新</button>
            </div>
        </div>
    </div>
    <div class="col-sm-12  layui-tab-content">
        <div class="mail-box" style="overflow-x:scroll;white-space:nowrap;">
            <table class="layui-table" lay-skin="line">
                <thead>
                    <tr>
                        <th hidden></th>
                        <th></th>
                        <th>受理单号</th>
                        <th>社区名称</th>
                        <th>业主姓名</th>
                        <th>业主电话</th>
                        <th>业主身份证</th>
                        <th>税号</th>
                        <th>应纳税额(元)</th>
                        <th>面积</th>
                        <th>租金(元/月)</th>
                        <th>产权属性</th>
                        <th>房屋属性</th>
                        <th>评定状态</th>
                        <th hidden>地址</th>
                    </tr>
                </thead>
                <tbody id="accordion">
                    @foreach (var item in Model.PageData)
                {
                        <tr>
                            <td hidden>@item.Evaluate_Id</td>
                            <td><input type="radio" name="chk" id="@item.Evaluate_Id" value="@item.Evaluate_Id" /></td>
                            <td>@item.Acceptance_TicketNumber</td>
                            <td>@item.CommunityName</td>
                            <td>@item.NatPer_Name</td>
                            <td>@item.NatPer_Phone</td>
                            <td>@item.NatPer_IDNumber</td>
                            <td>@item.Acceptance_TaxNumber</td>
                            <td>@(item.ETax*0.01)</td>
                            <td>@item.Hs_Proportion</td>
                            <td hidden>@(item.ReviewRent*0.01)</td>
                            <td>@(item.EReviewRent*0.01)</td>
                            <td>@item.Csqx</td>
                            <td>@item.AHA</td>
                            @if (@item.State == "被退回")
                        {
                                <td style="color:red">@item.State</td>
                        }
                        else
                        {
                                <td>@item.State</td>
                        }

                            <td hidden>@item.Acceptance_Address</td>
                            <td hidden>@item.Acceptance_Id</td>
                            <td hidden>@item.Review_Date</td>
                            <td hidden>@TimeHelper.TimeStampToDateTime(item.Lease_StartTime.ToString(), TimeHelper.ToTimeType.link_ymd)</td>
                            <td hidden>@TimeHelper.TimeStampToDateTime(item.Lease_EndTime.ToString(), TimeHelper.ToTimeType.link_ymd)</td>
                            <td hidden>@TimeHelper.TimeStampToDateTime(item.Acceptance_TaxStartTime.ToString(), TimeHelper.ToTimeType.link_ymd)</td>
                            <td hidden>@TimeHelper.TimeStampToDateTime(item.Acceptance_TaxEndTime.ToString(), TimeHelper.ToTimeType.link_ymd)</td>
                            <td hidden>@item.Tenant_Name</td>
                            <td hidden>@item.Hs_attribute</td>
                            <td hidden>@item.Hs_Cqsx</td>
                            <td hidden>@(item.leaseRent*0.01)</td>
                            <td hidden>@(item.EPropertyTax*0.01)</td>
                            <td hidden>@(item.EPersonalTax*0.01)</td>
                            <td hidden>@(item.ETotalTax*0.01)</td>
                            <td hidden>@item.Review_Comment</td>
                            <td hidden>@item.Evaluate_State</td>
                            <td hidden>@item.ReviewUser</td>
                            <td hidden>@TimeHelper.TimeStampToDateTime(item.Review_Date.ToString(), TimeHelper.ToTimeType.link_ymdt)</td>
                            <td hidden>@item.Evaluate_Comment</td>
                            <td hidden>@item.EvaluateUser</td>
                            @if (item.Evaluate_Date != 0)
                        {
                                <td hidden>@TimeHelper.TimeStampToDateTime(item.Evaluate_Date.ToString(), TimeHelper.ToTimeType.link_ymdt)</td>
                        }
                        else
                        {
                                <td hidden></td>
                        }
                            <td hidden>@item.Review_Id</td>
                            <td hidden>@item.Evaluate_Remarks</td>
                        </tr>

                }
                </tbody>
            </table>
            <div class="col-sm-12">
                <div class="col-sm-10">
                    @Html.Pager(Model.PageData, new PagerOptions { PageIndexParameterName = "index", ContainerTagName = "ul", PrevPageText = "上页", NextPageText = "下页", FirstPageText = "首页", LastPageText = "尾页", CssClass = "pagination", PagerItemsSeperator = "", CurrentPagerItemWrapperFormatString = "<li class=\"active\"><a href=\"#\">{0}</a></li>", PagerItemWrapperFormatString = "<li>{0}</li>" }, new { id = "bootstrappager", @class = "pagination" })
                </div>
                <div class="col-sm-2 to-righjt">
                    共 @Model.PageData.TotalItemCount 条记录，页 @Model.PageData.CurrentPageIndex/@Model.PageData.TotalPageCount
                </div>
            </div>
        </div>
    </div>
        <!-- 模态 -->
        <div id="myModal" hidden data-backdrop="static">
            <div class="layui-tab-content" style="overflow-y: auto;">
                <div class="modal-header">
                    <button id="btnSure" class="btn btn-white btn-sm" type="submit">
                        <span class="glyphicon glyphicon-pencil"></span> 推送
                    </button>
                    <button id="btnReturn" class="btn btn-white btn-sm">
                        <span class="glyphicon glyphicon-circle-arrow-right"></span> 退回
                    </button>
                </div>
                <div id="divfrom" class="layui-tab-content">
                    <form method="get" class="form-horizontal m-t">
                        <div class="layui-form-item" hidden>
                            <label class="col-sm-3 layui-form-label">Id：</label>
                            <div class="col-sm-9">
                                <input id="Evaluate_Id" type="text" class="form-control">
                                <input id="Acceptance_Id" type="text" class="form-control">
                                <input id="Evaluate_State" type="text" class="form-control">
                                <input id="Review_Id" type="text" class="form-control">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="col-sm-2 layui-form-label">地址：</label>
                            <div class="col-sm-10">
                                <input id="Acceptance_Address" type="text" class="form-control" readonly="readonly">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="col-sm-2 layui-form-label">业主姓名：</label>
                            <div class="col-sm-4">
                                <input id="NatPer_Name" type="text" class="form-control" readonly="readonly">
                            </div>
                            <label class="col-sm-2 layui-form-label">业主联系电话：</label>
                            <div class="col-sm-4">
                                <input id="NatPer_Phone" type="text" class="form-control" readonly="readonly">
                            </div>
                        </div>


                        <div class="layui-form-item">
                            <label class="col-sm-2 layui-form-label">业主身份证号：</label>
                            <div class="col-sm-4">
                                <input id="NatPer_IDNumber" type="text" class="form-control" readonly="readonly">
                            </div>
                            <label class="col-sm-2 layui-form-label">所属社区：</label>
                            <div class="col-sm-4">
                                <input id="CommunityName" type="text" class="form-control" readonly="readonly">

                            </div>
                        </div>


                        <div class="layui-form-item">
                            <label class="col-sm-2 layui-form-label">租赁起始时间：</label>
                            <div class="col-sm-4">
                                <input id="Lease_StartTime" type="text" class="laydate-icon  form-control layer-date" readonly="readonly">
                            </div>
                            <label class="col-sm-2 layui-form-label">租赁结束时间：</label>
                            <div class="col-sm-4">
                                <input id="Lease_EndTime" type="text" class="laydate-icon form-control layer-date" readonly="readonly">
                            </div>

                        </div>


                        <div class="layui-form-item" id="TaxEndTime">
                            <label class="col-sm-2 layui-form-label">税收起始时间：</label>
                            <div class="col-sm-4">
                                <input id="Acceptance_TaxStartTime" name="Acceptance_TaxStartTime" type="text" class="laydate-icon  form-control layer-date" readonly="readonly">
                            </div>
                            <label class="col-sm-2 layui-form-label">税收结束时间：</label>
                            <div class="col-sm-4">
                                <input id="Acceptance_TaxEndTime" name="Acceptance_TaxEndTime" type="text" class="laydate-icon form-control layer-date" readonly="readonly">
                            </div>

                        </div>

                        <div class="layui-form-item" id="TaxEndTime">
                            <label class="col-sm-2 layui-form-label">税号：</label>
                            <div class="col-sm-4">
                                <input id="Acceptance_TaxNumber" type="text" class="form-control" readonly="readonly">
                            </div>

                            <label class="col-sm-2 layui-form-label">付款人/单位：</label>
                            <div class="col-sm-4">
                                <input id="Tenant_Name" type="text" class="form-control" readonly="readonly">
                            </div>

                        </div>
                        <div class="layui-form-item">

                            <label class="col-sm-2 layui-form-label">
                                <nobr>产权属性：</nobr>
                            </label>
                            <div class="col-sm-4">
                                <select name="temp" class="form-control" id="Hs_Cqsx" disabled>
                                    <option value="1">个人</option>
                                    <option value="2">公用</option>
                                </select>
                            </div>
                            <label class="col-sm-2 layui-form-label">
                                <nobr>房屋属性：</nobr>
                            </label>
                            <div class="col-sm-4">
                                <select name="temp" class="form-control" id="Hs_attribute" disabled>
                                    <option value="1">住宅</option>
                                    <option value="2">非住宅</option>
                                </select>

                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="col-sm-2 layui-form-label">房屋面积(㎡)：</label>
                            <div class="col-sm-4">
                                <input id="Hs_Proportion" type="text" class="form-control" readonly="readonly">
                            </div>
                            <label class="col-sm-2 layui-form-label">初始租金(元/月)：</label>
                            <div class="col-sm-4">
                                <input id="Lease_Rent" type="text" class="form-control" readonly="readonly">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="col-sm-2 layui-form-label">评议人：</label>
                            <div class="col-sm-4">
                                <input id="ReviewUser" type="text" class="form-control" readonly="readonly">
                            </div>
                            <label class="col-sm-2 layui-form-label">评议租金(元/月)：</label>
                            <div class="col-sm-4">
                                <input id="Review_Rent" type="text" class="form-control" readonly="readonly">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="col-sm-2 layui-form-label">计税总额(元)：</label>
                            <div class="col-sm-10">
                                <input id="Evaluate_TotalTax" type="text" class="form-control" readonly="readonly">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="col-sm-2 layui-form-label">房产税(元)：</label>
                            <div class="col-sm-2">
                                <input id="Evaluate_PropertyTax" type="text" class="form-control" readonly="readonly"><!--房产税-->
                            </div>
                            <label class="col-sm-2 layui-form-label">个人所得税(元)：</label>
                            <div class="col-sm-2">
                                <input id="Evaluate_PersonalTax" type="text" class="form-control" readonly="readonly"><!--个人所得税-->

                            </div>
                            <label class="col-sm-2 layui-form-label">税金(元)：</label>
                            <div class="col-sm-2">
                                <input id="Evaluate_Tax" type="text" class="form-control" readonly="readonly"><!--税金-->

                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="col-sm-2 layui-form-label">评议意见：</label>
                            <div class="col-sm-10">
                                <input id="Review_Comment" class="form-control" autofocus="autofocus" readonly="readonly">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="col-sm-2 layui-form-label">评议时间：</label>
                            <div class="col-sm-4">
                                <input id="Review_Date" type="text" class="form-control" readonly="readonly">

                            </div>
                            <label class="col-sm-2 layui-form-label">评定租金(元/月)：</label>
                            <div class="col-sm-4">
                                <input id="Evaluate_Rent" type="text" class="form-control" placeholder="请输入评定租金" onchange="onRentChange();" autofocus="autofocus" datacol="yes" err="租金" checkexpession="Num">

                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="col-sm-2 layui-form-label">评定意见：</label>
                            <div class="col-sm-10">
                                <textarea id="Evaluate_Comment" rows="2" cols="20" class="form-control" autofocus="autofocus"></textarea>
                            </div>
                        </div>
                        <div class="layui-form-item" id="opinion" hidden>
                            <label class="col-sm-2 layui-form-label" style="color:red">被退回意见：</label>
                            <div class="col-sm-10">
                                <textarea id="Evaluate_Remarks" rows="2" cols="20" class="form-control" autofocus="autofocus" readonly="readonly"></textarea>
                            </div>
                        </div>
                    </form>

                </div>
            </div>
        </div>

        <!--查询-->
        @using (Html.BeginForm("Zor_Evaluate", "Base", new RouteValueDictionary { { "Model", Model } }, FormMethod.Get))
        {
        <!-- 查询模态框 -->
            <div id="myModalSearch" hidden data-backdrop="static">
                <div id="divfrom" class="layui-tab-content">
                    <div class="layui-form-item">
                        <label class="col-sm-2 layui-form-label">租赁起始时间：</label>
                        <div class="col-sm-4">
                            <input id="Search_StartTime" name="Lease_StartTime" type="text" class="laydate-icon  form-control layer-date" value="@Model.Lease_StartTime">
                        </div>
                        <label class="col-sm-2 layui-form-label">租赁结束时间：</label>
                        <div class="col-sm-4">
                            <input id="Search_EndTime" name="Lease_EndTime" type="text" class="laydate-icon form-control layer-date" value="@Model.Lease_EndTime">
                        </div>

                    </div>
                    <div class="hr-line-dashed"></div>
                    <div class="layui-form-item">
                        <label class="col-sm-2 layui-form-label">业主姓名：</label>
                        <div class="col-sm-4">
                            <input name="NatPer_Name" type="text" class="form-control" value="@Model.NatPer_Name">
                        </div>
                        <label class="col-sm-2 layui-form-label">业主联系电话：</label>
                        <div class="col-sm-4">
                            <input name="NatPer_Phone" type="text" class="form-control" value="@Model.NatPer_Phone">
                        </div>
                    </div>

                    <div class="hr-line-dashed"></div>
                    <div class="layui-form-item">
                        <label class="col-sm-2 layui-form-label f12">业主身份证号：</label>
                        <div class="col-sm-4">
                            <input name="NatPer_IDNumber" type="text" class="form-control" value="@Model.NatPer_IDNumber">
                        </div>
                        <label class="col-sm-2 layui-form-label">税号：</label>
                        <div class="col-sm-4">
                            <input name="Acceptance_TaxNumber" type="text" class="form-control" value="@Model.Acceptance_TaxNumber">
                        </div>
                    </div>
                    <div class="hr-line-dashed"></div>
                    <div class="layui-form-item">
                        <label class="col-sm-2 layui-form-label">付款人/单位：</label>
                        <div class="col-sm-4">
                            <input name="Tenant_Name" type="text" class="form-control" value="@Model.Tenant_Name">
                        </div>
                        <label class="col-sm-2 layui-form-label">受理单号：</label>
                        <div class="col-sm-4">
                            <input type="text" class="form-control" name="Acceptance_TicketNumber" value="@Model.Acceptance_TicketNumber">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="col-sm-2 layui-form-label">受理单状态：</label>
                        <div class="col-sm-4">
                            <select class="form-control" name="State">
                                <option value="全部" selected>全部</option>
                                <option value="@Model.State">已保存</option>
                                <option value="@Model.State">已评定</option>
                                <option value="@Model.State">退回至评议</option>
                                <option value="@Model.State">被退回</option>
                            </select>
                        </div>
                        <label class="col-sm-2 layui-form-label">发起类型：</label>
                        <div class="col-sm-4">
                            <select class="form-control" name="AcceptanceType">
                                <option value="全部" selected>全部</option>
                                <option value="@Model.AcceptanceType">社区</option>
                                <option value="@Model.AcceptanceType">自然人</option>

                            </select>
                        </div>
                    </div>

                    <div class="box-footer">
                        <button type="submit" class="btn btn-info pull-right">
                            <i class="fa fa-search"></i>查询
                        </button>
                    </div>
                </div>
            </div>

        }
        <!-- 详情模态 -->
        <div id="myModalDetails" hidden data-backdrop="static">
            <div id="divfrom" class="layui-tab-content">
                <form method="get" class="form-horizontal">
                    <div class="layui-form-item">
                        <label class="col-sm-2 layui-form-label">地址：</label>
                        <div class="col-sm-10 layui-input" id="Acceptance_AddressD"></div>
                    </div>
                    <div class="layui-form-item">
                        <label class="col-sm-2 layui-form-label">业主姓名：</label>
                        <div class="col-sm-4 layui-input" id="NatPer_NameD"></div>
                        <label class="col-sm-2 layui-form-label">业主联系电话：</label>
                        <div class="col-sm-4 layui-input" id="NatPer_PhoneD"> </div>
                    </div>


                    <div class="layui-form-item">
                        <label class="col-sm-2 layui-form-label">业主身份证号：</label>
                        <div class="col-sm-4 layui-input" id="NatPer_IDNumberD"></div>
                        <label class="col-sm-2 layui-form-label">所属社区：</label>
                        <div class="col-sm-4 layui-input" id="CommunityNameD"></div>
                    </div>


                    <div class="layui-form-item">
                        <label class="col-sm-2 layui-form-label">租赁起始时间：</label>
                        <div class="col-sm-4 layui-input laydate-icon layer-date" id="Lease_StartTimeD"></div>
                        <label class="col-sm-2 layui-form-label">租赁结束时间：</label>
                        <div class="col-sm-4 layui-input laydate-icon layer-date" id="Lease_EndTimeD"></div>
                    </div>


                    <div class="layui-form-item" id="TaxEndTime">
                        <label class="col-sm-2 layui-form-label">税收起始时间：</label>
                        <div class="col-sm-4 layui-input laydate-icon layer-date" id="Acceptance_TaxStartTimeD"></div>
                        <label class="col-sm-2 layui-form-label">税收结束时间：</label>
                        <div class="col-sm-4 layui-input laydate-icon layer-date" id="Acceptance_TaxEndTimeD"></div>
                    </div>

                    <div class="layui-form-item" id="TaxEndTime">
                        <label class="col-sm-2 layui-form-label">税号：</label>
                        <div class="col-sm-4 layui-input" id="Acceptance_TaxNumberD"></div>
                        <label class="col-sm-2 layui-form-label">付款人/单位：</label>
                        <div class="col-sm-4 layui-input" id="Tenant_NameD"> </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="col-sm-2 layui-form-label">房屋面积(㎡)：</label>
                        <div class="col-sm-2 layui-input" id="Hs_ProportionD"></div>
                        <label class="col-sm-2 layui-form-label">初始租金(元/月)：</label>
                        <div class="col-sm-2 layui-input" id="Lease_RentD"></div>
                        <label class="col-sm-2 layui-form-label">计税总额：</label>
                        <div class="col-sm-2 layui-input" id="Evaluate_TotalTaxD"></div>
                    </div>

                    <div class="layui-form-item">
                        <label class="col-sm-2 layui-form-label">
                            <nobr>产权属性：</nobr>
                        </label>
                        <div class="col-sm-4">
                            <select name="temp" class="form-control" id="Hs_CqsxD" disabled>
                                <option value="1">个人</option>
                                <option value="2">公用</option>
                            </select>
                        </div>
                        <label class="col-sm-2 layui-form-label">
                            <nobr>房屋属性：</nobr>
                        </label>
                        <div class="col-sm-4">
                            <select name="temp" class="form-control" id="Hs_attributeD" disabled>
                                <option value="1">住宅</option>
                                <option value="2">非住宅</option>
                            </select>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="col-sm-2 layui-form-label">房产税(元)：</label>
                        <div class="col-sm-2 layui-input" id="Evaluate_PropertyTaxD"></div> <!--房产税-->
                        <label class="col-sm-2 layui-form-label">个人所得税(元)：</label>
                        <div class="col-sm-2 layui-input" id="Evaluate_PersonalTaxD"> </div><!--个人所得税-->
                        <label class="col-sm-2 layui-form-label">税金(元)：</label>
                        <div class="col-sm-2 layui-input" id="Evaluate_TaxD"> </div> <!--税金-->
                    </div>

                    <div class="layui-form-item">
                        <label class="col-sm-2 layui-form-label">评议租金(元/月)：</label>
                        <div class="col-sm-2 layui-input" id="Review_RentD"></div>
                        <label class="col-sm-2 layui-form-label">评议人：</label>
                        <div class="col-sm-2 layui-input" id="ReviewUserD"> </div>
                        <label class="col-sm-2 layui-form-label">评议时间：</label>
                        <div class="col-sm-2 layui-input" id="Review_DateD"></div>
                    </div>

                    <div class="layui-form-item">
                        <label class="col-sm-2 layui-form-label">评议意见：</label>
                        <div class="col-sm-10 layui-input" id="Review_CommentD"></div>
                    </div>

                    <div class="layui-form-item">
                        <label class="col-sm-2 layui-form-label">评定租金(元/月)：</label>
                        <div class="col-sm-2 layui-input" id="Evaluate_RentD"></div>
                        <label class="col-sm-2 layui-form-label">评定人：</label>
                        <div class="col-sm-2 layui-input" id="EvaluateUser"></div>
                        <label class="col-sm-2 layui-form-label">评定时间：</label>
                        <div class="col-sm-2 layui-input" id="Evaluate_Date"> </div>
                    </div>


                    <div class="layui-form-item">
                        <label class="col-sm-2 layui-form-label">评定意见：</label>
                        <div class="col-sm-10 layui-input" id="Evaluate_CommentD"></div>
                    </div>
                </form>
            </div>
        </div>


</body>
<script type="text/javascript">
    $(function () {

        /**
 *   日期选择器---查询租赁日期
 */
        laydate.skin('molv');         //日历皮肤
        var startS = {                   //开始时间选择
            elem: "#Search_StartTime",
            format: "YYYY/MM/DD",
            min: '1900-01-01',
            max: "2099-06-16",
            istime: false,
            istoday: true,
            choose: function (datas) {
                end.min = datas;
                end.start = datas
            }
        };
        var endS = {                     //结束时间选择
            elem: "#Search_EndTime",
            format: "YYYY/MM/DD",
            min: '1900-01-01',
            max: "2099-06-16",
            istime: false,
            istoday: true,
            choose: function (datas) { start.max = datas }
        };
        laydate(startS);
        laydate(endS);


        /*刷新*/

        $("#btnRefresh").click(function () {
            Replace();
        });

        /*查询*/

        $("#btnSearchFull").click(function () {
            LayerOpen('900px', '350px', '查询', $('#myModalSearch'));
        });

       /** 评定推送 */

        $("#btnSure").click(function () {
            if ($("#Evaluate_Comment").val() == "") {
                layer.msg("评定意见不能为空", 0);
                return;
            }

            var rentMoney = $("#Evaluate_Rent").val(); //获取评定税金
            if (rentMoney == "") {
                layer.msg("请输评定租金!", 0);
                return;
            }
            if (!rentMoney.match(/^\d+(\.\d{2})?$/)) {
                layer.msg("评定租金输入有误,请输入到小数点后面两位！", 0);
                return;
            }
            if (rentMoney == 0) {
                layer.msg("评定租金输入有误,租金不能为0元", 0);
                return;
            }

            
            var Evaluate_PropertyTax = $("#Evaluate_PropertyTax").val() * 100;
            var Evaluate_PersonalTax = $("#Evaluate_PersonalTax").val() * 100;
            var Evaluate_Tax = Number(Evaluate_PropertyTax) + Number(Evaluate_PersonalTax);
            //把计税总额表达式更改成单一值
            var Acceptance_TaxStartTime = $("#Acceptance_TaxStartTime").val();
            var Acceptance_TaxEndTime = $("#Acceptance_TaxEndTime").val();
            var countM = countMonth(Acceptance_TaxStartTime, Acceptance_TaxEndTime); //获取月份
            var Evaluate_TotalTax = rentMoney * 100 * countM;

            var accpid = $("#Acceptance_Id").val();
            $("#Evaluate_PropertyTax").val(Evaluate_PropertyTax);
            $("#Evaluate_PersonalTax").val(Evaluate_PersonalTax);
            $("#Evaluate_Tax").val(Evaluate_Tax);                 
            $("#Evaluate_TotalTax").val(Evaluate_TotalTax);
           
            var JsData = GetWebControls(divfrom);
            ZorPostSimpleData("/Base/Evaluate", JSON.stringify({ "evaluate": JsData, "accpid": accpid }), function (data) {
                layer.msg(data.AnswerMeg, function () {
                    layer.closeAll();
                    Replace();
                });
            });

        })

        /** 评定 */

        $("#btnUpdate").click(function () {
            var checkId = CheckboxValueIDs();          
            $("#tenant_id").attr("disabled", "disabled");
            if (checkId.length == 0) {
                layer.msg("请选择要评定的信息！");
                return;
            }
            if (checkId.length > 1) {
                layer.msg("仅可选择一行信息评定！");
                return;
            }
            if ($("#Evaluate_State").val() != 2 && $("#Evaluate_State").val() != 0 && $("#Evaluate_State").val() != null && $("#Evaluate_State").val() != "") {
                layer.msg("非正常流程，评定失败！");
                return;
            }

            var Acceptance_TaxStartTime=getTableCell(20);
            var Acceptance_TaxEndTime=getTableCell(21);
            var countM = countMonth(Acceptance_TaxStartTime, Acceptance_TaxEndTime); //获取月份


            $("#Evaluate_Id").val(getTableCell(0));
            $("#Acceptance_TicketNumber").val(getTableCell(2));
            $("#CommunityName").val(getTableCell(3));
            $("#NatPer_Name").val(getTableCell(4));
            $("#NatPer_Phone").val(getTableCell(5));
            $("#NatPer_IDNumber").val(getTableCell(6));
            $("#Acceptance_TaxNumber").val(getTableCell(7));
            $("#Hs_Proportion").val(getTableCell(9));
            $("#Review_Rent").val(getTableCell(10));//评议租金
            $("#Lease_Rent").val(getTableCell(25));
            $("#Lease_StartTime").val(getTableCell(18));
            $("#Lease_EndTime").val(getTableCell(19));
            $("#Acceptance_TaxStartTime").val(getTableCell(20));
            $("#Acceptance_TaxEndTime").val(getTableCell(21));
            $("#Hs_Cqsxs").val(getTableCell(24));
            $("#Hs_attribute").val(getTableCell(23));
            $("#Tenant_Name").val(getTableCell(22));
            $("#Acceptance_Address").val(getTableCell(15));
            $("#Evaluate_PropertyTax").val(getTableCell(26));
            $("#Evaluate_PersonalTax").val(getTableCell(27));
            $("#Evaluate_TotalTax").val(getTableCell(10) + "X" + countM + "=" + getTableCell(28));//
            $("#Acceptance_Id").val(getTableCell(16));
            $("#Review_Comment").val(getTableCell(29));
            $("#Evaluate_State").val(getTableCell(30));
            $("#ReviewUser").val(getTableCell(31));
            $("#Review_Date").val(getTableCell(32));
            $("#Evaluate_Comment").val(getTableCell(33));
            $("#Evaluate_Tax").val(getTableCell(8));
            $("#Evaluate_Rent").val(getTableCell(11));
            $("#Review_Id").val(getTableCell(36));

            var EvaluateState = getTableCell(14); //获取评定状态           
            if (EvaluateState == "被退回") {
                //显示被退回意见
                $("#opinion").show(); //显示退回意见
                $("#Evaluate_Remarks").val(getTableCell(37)); 
            }
            else {
                $("#opinion").hide(); //不显示退回意见
            }
            LayerOpen('920px', '660px', '评定推送', $('#myModal'));

        })
        /*退回*/
        $("#btnReturn").click(function () {
            if ($("#Evaluate_State").val() != 2 && $("#Evaluate_State").val() != 0 && $("#Evaluate_State").val() != null && $("#Evaluate_State").val() != "") {
                layer.msg("已提交至上级不能退回！");
                return;
            }
                var accpid =getTableCell(16)
                var JsData = GetWebControls(divfrom);
                ZorPostSimpleData("/Base/ReturnReview", JSON.stringify({ "evaluate": JsData, 'accpid': accpid }), function (data) {
                    layer.msg(data.AnswerMeg, function () {
                        layer.closeAll();
                        Replace();
                    });
                })
           
        });

        /*** 详情*/

        $("#btnMessage").click(function () {
            var checkId = CheckboxValueIDs();         
            $("#tenant_id").attr("disabled", "disabled");
            if (checkId.length == 0) {
                layer.msg("请选择要查看评定的信息！");
                return;
            }
            if (checkId.length > 1) {
                layer.msg("仅可选择一行查看的评定信息！");
                return;
            }
            $("#Evaluate_IdD").html(getTableCell(0));
            $("#Acceptance_TicketNumberD").html(getTableCell(2));
            $("#CommunityNameD").html(getTableCell(3));
            $("#NatPer_NameD").html(getTableCell(4));
            $("#NatPer_PhoneD").html(getTableCell(5));
            $("#NatPer_IDNumberD").html(getTableCell(6));
            $("#Acceptance_TaxNumberD").html(getTableCell(7));
            $("#Hs_ProportionD").html(getTableCell(9));
            $("#Review_RentD").html(getTableCell(10));
            $("#Lease_RentD").html(getTableCell(25));
            $("#Lease_StartTimeD").html(getTableCell(18));
            $("#Lease_EndTimeD").html(getTableCell(19));
            $("#Acceptance_TaxStartTimeD").html(getTableCell(20));
            $("#Acceptance_TaxEndTimeD").html(getTableCell(21));
            $("#Hs_CqsxsD").val(getTableCell(24));
            $("#Hs_attributeD").val(getTableCell(23));
            $("#Tenant_NameD").html(getTableCell(22));
            $("#Acceptance_AddressD").html(getTableCell(15));
            $("#Evaluate_PropertyTaxD").html(getTableCell(26));
            $("#Evaluate_PersonalTaxD").html(getTableCell(27));
            $("#Evaluate_TotalTaxD").html(getTableCell(28));
            $("#Acceptance_IdD").html(getTableCell(16));
            $("#Review_CommentD").html(getTableCell(29));
            $("#Evaluate_StateD").html(getTableCell(30));
            $("#ReviewUserD").html(getTableCell(31));
            $("#Review_DateD").html(getTableCell(32));
            $("#Evaluate_CommentD").html(getTableCell(33));
            $("#EvaluateUser").html(getTableCell(34));
            $("#Evaluate_Date").html(getTableCell(35));
            $("#Evaluate_TaxD").html(getTableCell(8));
            $("#Evaluate_RentD").html(getTableCell(11));
            LayerOpen('900px', '650px', '评定详情', $('#myModalDetails'));
        })
      
        /*** 全选 */

        $("#cbkCheckAll").click(function () {
            if (this.checked) {
                $("input[name='chk']").prop('checked', true);
            } else {
                $("input[name='chk']").prop('checked', false);
            }
        })
    });

    //评议时，修改租金，改变计税总额、税金、房产税、个人所得税
    function onRentChange() {

        //计算房产税、个税
        var bgDate = getTableCell(20);
        var endDate = getTableCell(21);
        var countM = countMonth(bgDate, endDate); //获取月份  

        var rentMoney = $("#Evaluate_Rent").val(); //获取评定税金
        if (rentMoney == "") {
            layer.msg("请输评定租金!", 0);
            return;
        }
        if (!rentMoney.match(/^\d+(\.\d{2})?$/)) {
            layer.msg("评定租金输入有误,请输入到小数点后面两位！", 0);
            return;
        }
        if (rentMoney == 0) {
            layer.msg("评定租金输入有误,租金不能为0元", 0);
            return;
        }


        var type = $("#Hs_attribute").val();
      
        getRatMoney(bgDate, endDate, rentMoney, type);
        $("#Evaluate_PropertyTax").val(fcRat.toFixed(2));
        $("#Evaluate_PersonalTax").val(GrRat.toFixed(2));
        $("#Evaluate_Tax").val(jszje.toFixed(2));

        $("#Evaluate_TotalTax").val(rentMoney + "X" + countM + "=" + totalRent.toFixed(2));
    }


    //计算月份方法
    function countMonth(bgDate, endDate) {
        var monthDif = 0; //月份
        var dtBegin = new Date(bgDate);
        var dtEnd = new Date(endDate);
        var bgDay = dtBegin.getDate();
        var endDay = dtEnd.getDate();

        //计算税收月份
        var diff = 0;
        var dayDiff = endDay - bgDay + 1;
        if (dayDiff < -15) {
            diff = -1;
        } else if (dayDiff >= 15) {
            diff = 1;
        } else {
            diff = 0;
        }

        var yearsDif = dtEnd.getFullYear() - dtBegin.getFullYear();
        monthDif = dtEnd.getMonth() - dtBegin.getMonth() + yearsDif * 12 + diff;
        return monthDif;
    }
</script>



</html>

